package edu.zjut.hjg.saas.biz.model;

import java.util.Date;

import edu.zjut.hjg.saas.common.util.JsonUtil;

public class Recipe {
    private Integer      id;
    private Kindergarten kindergarten = new Kindergarten();
    private User         user         = new User();
    private String       content;
    private Date         editTime;
    private Integer      theWeek;
    private CookBook     cookBook;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Kindergarten getKindergarten() {
        return kindergarten;
    }

    public void setKindergarten(Kindergarten kindergarten) {
        this.kindergarten = kindergarten;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
        this.cookBook = JsonUtil.fromJSON(content, CookBook.class);
    }

    public Date getEditTime() {
        return editTime;
    }

    public void setEditTime(Date editTime) {
        this.editTime = editTime;
    }

    public Integer getTheWeek() {
        return theWeek;
    }

    public void setTheWeek(Integer theWeek) {
        this.theWeek = theWeek;
    }

    public CookBook getCookBook() {
        return cookBook;
    }

    public void setCookBook(CookBook cookBook) {
        this.cookBook = cookBook;
        this.content = JsonUtil.toJSON(cookBook);
    }

    @Override
    public String toString() {
        return "Recipe [content=" + content + ", cookBook=" + cookBook + ", editTime=" + editTime
                + ", id=" + id + ", kindergarten=" + kindergarten + ", theWeek=" + theWeek
                + ", user=" + user + "]";
    }
}
